#!/bin/bash
#This is a qemu-ifdown script for bridging. 
#You can use it when starting a KVM guest with bridge mode network.
#Don't use this script in most cases; QEMU will handle it automatically.

#set your bridge name
switch=br0

if [ -n "$1" ]; then
	# Delete the specified interfacename
	# tunctl -d $1
	#release TAP interface from bridge
	brctl delif ${switch} $1
	#shutdown the TAP interface
	ip link set $1 down
	exit 0
else
	echo "Error: no interface specified"
	exit 1
fi
